<template>
	<div class="body">
		<!-- 设置  -->
		<!-- <div class="header">
			<div>
				<img @click="returnGo" src="../../assets/homeimg/滑动左.png" />
				<span>设置</span>
			</div>
		</div> -->
		<!-- <Header><span>设置</span></Header> -->
		<div class="min">
			<div class="neirong" @click="update">
				<span>版本更新</span>
				<img src="../../assets/homeimg/滑动右.png" alt />
			</div>
			<div class="neirong" @click="about">
				<span>关于我们</span>
				<img src="../../assets/homeimg/滑动右.png" alt />
			</div>
			<div class="neirong" @click="call">
				<span>联系我们</span>
				<img src="../../assets/homeimg/滑动右.png" alt />
			</div>
			<div class="neirong" @click="zhuxiao">
				<span>注销</span>
				<img src="../../assets/homeimg/滑动右.png" alt />
			</div>
			<div class="foot" @click="logout">退出</div>
			<!-- <div class="yinsi" @click="toYinsi">隐私协议</div> -->
		</div>
		<!-- <div class="company">Copyright©2012-2020优学（深圳）教育科技发展有限公司版权所有</div> -->
	</div>
</template>
<script>
	import {
		Toast
	} from "vant";
	import mineApi from "@/api/mine";
	import Header from "@/components/header";
	export default {
		data() {
			return {
				phone: '',
				token: ''
			};
		},
		components: {
			// [Image.name]: Image
			Header
		},
		created() {
			// if (localStorage.getItem("user")) {
			// 	var info = JSON.parse(localStorage.getItem("user"));
			// }
			// this.token = info.token
			if(this.$route.query.token){
				this.$store.commit('SAVE_TOKEN',this.$route.query.token)
			}
			// this.getphone();
		},
		methods: {
			returnGo() {
				// this.$router.go(-1);
				window.webkit.messageHandlers.pageBack_js_oc.postMessage([])
			},
			update() {
				this.$router.push('/update')
			},
			// getphone() {

			// },
			call() {
				// Toast({
				// 	message: '111'
				// });
				this.$http.post('/api/set/phone').then(res => {
					this.phone = res.data;
					let data = {
						phone: this.phone
					}
					window.h5_android && window.h5_android.callPhone(JSON.stringify(data));
					window.webkit.messageHandlers.callTel_js_oc.postMessage([this.phone])
				})
				// mineApi.phone({
				// 	token: this.token
				// }).then(res => {
				// 	console.log(res);
					
				// 	this.phone = res.data;
				// 	window.webkit.messageHandlers.callTel_js_oc.postMessage([this.phone])
				// 	// this.callPhone(this.phone)
				// });

			},
			// 调用拨号功能
			callPhone (phoneNumber) {
			    window.location.href = 'tel://' + phoneNumber
			},
			about() {
				this.$router.push('/aboutus')
			},
			zhuxiao(){
				this.$store.commit('SAVE_TOKEN','');
				this.$router.back();
				window.h5_android && window.h5_android.logout();
				window.webkit.messageHandlers.userLogout_js_oc.postMessage([]);
			},
			logout(){
				this.$store.commit('SAVE_TOKEN','');
				this.$router.back();
				window.h5_android && window.h5_android.logout();
				window.webkit.messageHandlers.userLogout_js_oc.postMessage([]);
			},
			toYinsi(){
				this.$router.push('/yinsi')
			}
		}
	};
</script>
<style lang="scss" scoped="scoped">
.company{
	text-align: center;
	width: 30.33vw;
	margin: 12vw auto 0;
	font-size: 12px;
}
	.body {
		color: #333333;
		height: 100%;
		display: flex;
		flex-direction: column;
	}

	.header {
		// font-weight: bold;
		width: 100%;
		text-align: center;
		height: 2.75rem;
		line-height: 2.75rem;
		padding-top: 1.25rem;
		position: relative;
		border-bottom: 1px solid #dcdcdc;
		color: #333333;
		font-size: 1.25rem;

		img {
			width: 0.625rem;
			height: 1.125rem;
			position: absolute;
			left: 1rem;
			bottom: 0.75rem;
		}
	}

	.min {
		width: 100%;
		flex: 1;

		.neirong {
			width: 100%;
			height: 2.75rem;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 1px solid #dcdcdc;

			span {
				margin-left: 1rem;
				font-size: 1rem;
				color: #333333;
			}

			img {
				width: 0.625rem;
				height: 1rem;
				margin-right: 1rem;
			}
		}

		.foot {
			width: 18.4375rem;
			height: 2.75rem;
			margin: 0 auto;
			margin-top: 20rem;
			text-align: center;
			background: linear-gradient(90deg,
				rgba(255, 208, 65, 1) 0%,
				rgba(255, 178, 9, 1) 100%);
			border-radius: 1.375rem;
			font-size: 1.125rem;
			color: rgba(255, 255, 255, 1);
			line-height: 2.75rem;
		}
		.yinsi{
			width: 18.4375rem;
			height: 2rem;
			margin: 1rem auto;
			text-align: center;
			color: rgb(11, 72, 204);
		}
	}
</style>
